package team.seekers.hula.common.entity.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;
import lombok.Getter;

import java.util.Arrays;

/**
 * 反馈通知
 */


@Getter
public enum FeedbackEnum implements IEnum<Integer> {

    // 反馈给生产者
    // 系统发出
    ADD_QUESTION_PASS(1,  "问题审核通过"),
    ADD_QUESTION_FAIL(2,  "问题审核不通过"),
    ADD_QUESTION_OFFEND(3,  "问题违规举报"),

    ADD_POINT_PASS(4, "观点审核通过"),
    ADD_POINT_FAIL(5,"观点审核不通过"),
    ADD_POINT_OFFEND(6,"观点违规举报"),

    ADD_ANSWER_PASS(7, "回答审核通过"),
    ADD_ANSWER_FAIL(8,"回答审核不通过"),
    ADD_ANSWER_OFFEND(9,"回答违规举报"),

    // 用户发出
    ADD_QUESTION_FEEDBACK(10,  "问题收到反馈"),

    // 普通提问提问者发出
    ADD_POINT_BACK(11,"观点被驳回"),

    // 反馈给系统管理员
    // 用户发出
    ADD_ADMIN_QUESTION_OFFEND(12,  "问题违规举报待审核"),
    ADD_ADMIN_POINT_OFFEND(13,  "观点违规举报待审核"),
    ADD_ADMIN_ANSWER_OFFEND(14,  "回答违规举报待审核"),
    ADD_ADMIN_ANSWER_COMMENT_OFFEND(14,  "评论违规举报待审核");


    private int type;

    private String name;

    FeedbackEnum(int type, String name) {
        this.type = type;
        this.name = name;
    }

    @Override
    public Integer getValue() {
        return this.type;
    }

    public static FeedbackEnum getByType(int type) {
        return Arrays.stream(values()).filter(e -> e.getType() == type).findFirst().orElse(null);
    }

    public static FeedbackEnum getByName(String name) {
        return Arrays.stream(values()).filter(e -> e.getName().equals(name)).findFirst().orElse(null);
    }
}
